<!--
 作者 : 唐梓元
 日期 : 2019-6-27
 版本 : 1.0
 描述 :首页导航
 使用 : <cmHeader :searchShow="true"></cmHeader>
 参数 :searchShow 默认是'false'，值为FALSE的时候显示正常导航，搜索框隐藏
 -->
<template>
  <div class='bannerWrapper' >
    <div class='navWrapper minWidth' >
      <ul  >
        <li class='leftLi'>
          <!--左边导航下拉菜单-->
          <ul>
            <li v-for='(item,index) in navListLeft' :key='index' v-text='item.name' @click="do_selectResult(index)" :class="selectNum==index?'active':''"> </li>
          </ul>
          <!--左边下拉菜单控制的选项卡-->
          <div class="navContent" v-show="navContentShow">
            <div class="subjectWrapper" v-show="selectNum===1" >
              <ul class="subject" v-for="(item,index) in bannerNav.LearnStage" :key="index">
                <li v-text="item.ShowModel" > </li>
                <li> <span v-for="(itemSub,index) in item.detail" :key="index">{{itemSub.Name}}（{{itemSub.Number}}）</span></li>
              </ul>
            </div>
            <div class="scopeWrapper" v-show="selectNum===2" >
              <span v-for="(item,index) in bannerNav.TopCount" :key="index" v-text="`${item.Name}（${item.Number}）`"></span>
            </div>
            <div class="systemWrapper subjectWrapper" v-show="selectNum===3" >
              <ul class="system subject" v-for="(item,index) in bannerNav.CountyCount" :key="index">
                <li v-text="item.ShowModel" > </li>
                <li> <span v-for="(itemSys,index) in item.detail" :key="index" v-text="`${itemSys.Name}（${itemSys.Number}）`"></span></li>
              </ul>
            </div>
            <div class="yearContent subjectWrapper" v-show="selectNum===4" >
              <ul class="year subject" v-for="(item,index) in bannerNav.YearCount" :key="index">
                <li v-text="item.ShowModel" ></li>
                <li > <span v-for="(itemYear,index) in item.detail" :key="index" v-text="`${itemYear.Name}（${itemYear.Number}）`"></span></li>
              </ul>
            </div>
            <div class="yearContent subjectWrapper" v-show="selectNum===5" >
              <ul class="year subject" v-for="(item,index) in bannerNav.LevelCount" :key="index">
                <li v-text="item.ShowModel" ></li>
                <li > <span v-for="(itemgrade,index) in item.detail" :key="index" v-text="`${itemgrade.Name}（${itemgrade.Number}）`"></span></li>
              </ul>
            </div>
          </div>
        </li>
        <!--横向导航-->
        <li v-for="(item,index) in navList" :key="index" >  <span v-text='item.name' class="nav" @click.stop="def_routerLink(item.path)" :class="index==0?'isActive':''"></span></li>
      </ul>
    </div>
    <div class="bgImg">
      <div></div>
    </div>
  </div>
</template>

<script>
    export default {
        name: "bannerNav",
      data(){
          return{
            navContentShow: false,//选项卡内容是否显示控制
            firstSelect: [true, true, true, true, true, true],//判断每个选项卡标题是第一次点击
            selectNum: '',
            navList: [
              {name: '首页', path: "/BS_cgkHome"}, {name: '查询', path: "/yw_cgkQuery"}, {name: '收藏', path: "/yw_cgkCollect"}, {name: '分析', path: "/yw_cgkAnalyse"}, {name: '管理入口', path: "/yw_cgkManage"}
            ],
            navListLeft: [
              {name: '成果类别'}, {name: '学段学科'}, {name: '成果范围'}, {name: '所属系统'}, {name: '所属年度'}, {name: '获奖等级'}
            ]

          }
      },
      props:{
        bannerNav:Object
      },
      created(){


      },
      methods:{

        do_selectResult(index) {
          if (index == 0) {
            return
          }
          if (this.firstSelect[index]) {
            this.navContentShow = true
          }
          if (this.selectNum == index) {
            this.navContentShow = !this.navContentShow
          } else {
            this.navContentShow = true
          }
          this.firstSelect[index] = false
          this.selectNum = index;

        },
        def_routerLink(path) {
          this.$router.push(path)
        },

      }
    }
</script>

<style scoped>
  ul{
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .navWrapper>ul{
    width:100% ;
  }
  .navWrapper>ul li{
    float: left;
    height: 40px;
    line-height: 40px;
    width: 110px;
    text-align: center
  }
  .navWrapper>ul li span {
    display: inline;
    cursor: pointer;
  }
  .navWrapper>ul .leftLi{
    width: 200px;
    background-color: #418CFF;
    color: white;
    position: relative;
  }
  .leftLi ul{
    width: 100%;
    /*height: 40px;*/
  }
  .leftLi ul li{
    float: none;
    width: 100%;
    border-bottom: 1px solid gainsboro;
    border-top:none;
    cursor: pointer;
    background-color: rgba(0,0,0,.1);
  }
  .leftLi ul li:last-child{
    border: none;
  }
  .navContent{
    position: absolute;
    width: 500px;
    height: 200px;
    border: 1px solid #007bff;
    box-sizing: border-box;
    left: 199px;
    top: 40px;
    overflow: auto;
    background-color: white;
    padding-top: 5px;
  }
  .navContent>div{
    padding:0 10px;
  }
  .navContent>div>ul>li{
    text-align: left ;
    border: none;
  }
  .subjectWrapper .subject li{
    height:auto;
    line-height: 20px ;
    font-size: 16px;
    color: grey;
    background-color: white;
  }
  .subjectWrapper .subject li span{
    display: inline-block;
    width: 19.4%;
    font-size: 14px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
  .subject li:first-child{
    color: #418CFF;
    height: 25px;
    line-height: 25px;
  }
  .scopeWrapper{
    line-height: 25px;
  }
  .navContent .scopeWrapper span{
    display: inline-block;
    width: 32%;
    text-align: left;
    height: 25px;
    line-height: 25px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    font-size: 14px;
    color: grey;
  }
  .systemWrapper .system li span{
    width: 49%;
  }
  .yearContent .year li span{
    width: 32.5%;
  }
  .active{
    background-color: rgba(0,0,0,.2)!important;
  }
  .isActive{
    color: #418CFF;
  }
  .navWrapper>ul:after{
    display: block;
    content: '';
    width: 0;
    height: 0;
    clear: both;
  }
  .bannerWrapper{
    position: relative;
    overflow:hidden;
    margin-top: 10px;
  }
  .bgImg{
    background: url("../../assets/Home/banner.png") center center no-repeat;
    background-size: 100% 100%;
    width: 100%;
    height: 200px;
    position: relative;
    top: -10px;
    background-color: rgba(115, 190, 250,.1);
    z-index: -1;
  }

  .selectWrapper>div>span{
    flex:0 0 120px;
  }
  .selectWrapper>div{
    height: 40px;
    line-height: 40px;
    border-bottom: 1px solid gainsboro;
    font-size: 14px;
    color: grey;
  }
  .cgList ul li{
    width: 130px;
    height: 40px;
    text-align: center;
    font-size: 14px;
  }
  .cgList ul li span{
    cursor: pointer;
    padding: 1px 5px 2px;
  }
  .cgList ul li .cgNameActive{
    padding: 1px 5px 2px;
    background-color: #417fff;
    color: white;
  }
  .scopeWrapper{
    margin-top: 10px;
  }
.subject li:first-child{
  margin-top: -2px;
}
</style>
